package com.yuzhyn.hiops.app.application.schedule;

import com.yuzhyn.azylee.core.datas.ids.UUIDTool;
import com.yuzhyn.azylee.core.threads.sleeps.Sleep;
import com.yuzhyn.azylee.websdk.args.WebSdk;
import com.yuzhyn.hiops.app.application.service.JobService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@EnableScheduling
public class CustSchedule {

    @Autowired
    JobService jobService;

    @Scheduled(cron = "0 */1 * * * ?")
    public void job() {
//        jobAsy();
//        jobAsy();
//        jobAsy();
//        jobAsy();
//        jobAsy();
//        jobAsy();
//        jobAsy();
//        jobAsy();
//        jobAsy();
//        jobAsy();

//        jobService.jobAsy();
//        jobService.jobAsy();
//        jobService.jobAsy();
//        jobService.jobAsy();
//        jobService.jobAsy();
//        jobService.jobAsy();
//        jobService.jobAsy();
//        jobService.jobAsy();
//        jobService.jobAsy();
//        jobService.jobAsy();
    }

    @Async
    void jobAsy() {
        log.error(System.currentTimeMillis() + " , " + WebSdk.SnowFlake.nexts());
        Sleep.s(2);
    }

    void step01() {
        int i = 0;
//        throw
    }
}
